package health.lm.com.shop.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import health.lm.com.shop.R;
import health.lm.com.shop.entity.OrganizationEntity;

/**
 * Created by Android Studio .
 * Project：hlian health.lm.com.shop.adapter
 * Date：2019/8/29 14:07
 * Introduce：组织架构
 */
public class OrganizationAdapter extends BaseQuickAdapter<OrganizationEntity, BaseViewHolder> {
    public OrganizationAdapter(@Nullable List<OrganizationEntity> data) {
        super(R.layout.activity_organization_chart_item, data);
    }

    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * @param helper A fully initialized helper.
     * @param item   The item that needs to be displayed.
     */
    @Override
    protected void convert(@NonNull BaseViewHolder helper, OrganizationEntity item) {
        helper.setText(R.id.textView71, item.getTitle() + "(" + item.getNum() + ")");
        //判断最后一个不显示左侧下方那条线
        helper.setGone(R.id.textView72, helper.getAdapterPosition() != getData().size() -1);
    }
}
